package com.zwd.deep.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.db.PageResult;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zwd.deep.entity.dto.HistoryPageDTO;
import com.zwd.deep.entity.po.HistoryRecords;
import com.zwd.deep.entity.vo.HistoryRecordVo;
import com.zwd.deep.mapper.HistoryRecordsMapper;
import com.zwd.deep.service.IHistoryRecordsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 历史记录表 服务实现类
 * </p>
 *
 * @author zwd
 * @since 2025-02-12
 */
@Service
public class HistoryRecordsServiceImpl extends ServiceImpl<HistoryRecordsMapper, HistoryRecords> implements IHistoryRecordsService {

    @Autowired
    private HistoryRecordsMapper historyRecordsMapper;
    @Override
    public List<HistoryRecordVo> getHistoryRecords(HistoryPageDTO historyPageDTO) {
        Page<HistoryRecords> page = new Page<>(historyPageDTO.getPage(), historyPageDTO.getSize());
        Page<HistoryRecords> historyRecordsPage = historyRecordsMapper.selectPage(page, null);
        List<HistoryRecordVo> historyRecordVos = BeanUtil.copyToList(historyRecordsPage.getRecords(), HistoryRecordVo.class);
        return historyRecordVos;
    }
}
